<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <style>
    .textarea-style {
      border: 1px solid #000001;
      border-radius: 5pt;
      height: 60pt;
      font-size: 10pt;
      margin-bottom: 2vh;
      width: 100%;
      color: #000001;
      overflow-x: hidden;
      text-indent: 20px;
    }
  </style>
  <body>
    <textarea
      id="handledMsg"
      maxlength="200"
      cols="70"
      rows="5"
      class="textarea-style"
      placeholder="请输入处理方法,不超过200字"
      onkeyup="setLength(this,200,'wordsLength');"
    ></textarea>
    <span id="wordsLength" style="position: absolute; right: 5px; bottom: 3vh; font-size: 12px; color: #bdcada">0/200</span>
  </body>
  <script>
    function setLength(obj, maxlength, id) {
      var num = maxlength - obj.value.length;
      var leng = id;
      if (num < 0) {
        num = 0;
      }
      document.getElementById(leng).innerHTML = num + "/200";
    }
  </script>
</html>
